import hotshot
import logging
import datetime
from Autotests.Cloud.Clients.ManagementService import ManagementService
from Autotests.Suites.StressTest.Selector.PartnersSelector import PartnersSelector
from Config.RunConfig import RunConfig, Options

def runWorker():
    manserv = ManagementService()

    if RunConfig().get(Options.StressTest.logger) == 'True':
        logging.basicConfig(format='[%(asctime)s] %(message)s', filename="/temp/TestClient_" +
                            datetime.datetime.utcnow().strftime('%Y_%m_%d')+ ".log", level=logging.INFO)
        logging.getLogger('StressTest').setLevel(logging.DEBUG)


    if RunConfig().get(Options.StressTest.stressAllPartners) == 'True':
        PartnersSelector().runForAllPartners(manserv)
    else:
        PartnersSelector().runForSimplePartner(manserv)

if __name__ == "__main__":
    runWorker()
